package com.wc.AlgoOJ._线性DP.CT0115;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/1/4 21:48
 * @description 光头强和宝藏
 * http://43.138.190.70:8888/p/CT0115
 */
public class Main {
    static FastReader in = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int t = in.nextInt();
        while (t-- > 0) {
            int n = in.nextInt();
            int[] array = new int[n + 1];
            for (int i = 1; i <= n; i++) {
                array[i] = in.nextInt();
            }
            int[] dp = new int[n + 1];
            dp[1] = array[1];
            if (n == 1) {
                out.println(dp[n]);
                continue;
            }
            dp[2] = Math.max(array[1], array[2]);
            for (int i = 3; i <= n; i++) {
                dp[i] = Math.max(dp[i - 1], array[i] + dp[i - 2]);
            }
            out.println(dp[n]);
        }
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }
}
